'\" t
.\"     Title: gpspipe
.\"    Author: Gary E. Miller
.\" Generator: Asciidoctor 2.0.18
.\"      Date: 2023-01-10
.\"    Manual: GPSD Documentation
.\"    Source: GPSD, Version 3.25
.\"  Language: English
.\"
.TH "GPSPIPE" "1" "2023-01-10" "GPSD, Version 3.25" "GPSD Documentation"
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.ss \n[.ss] 0
.nh
.ad l
.de URL
\fI\\$2\fP <\\$1>\\$3
..
.als MTO URL
.if \n[.g] \{\
.  mso www.tmac
.  am URL
.    ad l
.  .
.  am MTO
.    ad l
.  .
.  LINKSTYLE blue R < >
.\}
.SH "NAME"
gpspipe \- tool to connect to gpsd and retrieve sentences
.SH "SYNOPSIS"
.sp
\fBgpspipe\fP [OPTIONS] [server[:port[:device]]]
.sp
\fBgpspipe\fP \-h
.sp
\fBgpspipe\fP \-V
.SH "DESCRIPTION"
.sp
\fBgpspipe\fP is a tool to connect to \fBgpsd\fP and output the received sentences
to stdout. This makes the program useful as a pipe from \fBgpsd\fP to another
program or file.
.sp
\fBgpspipe\fP does not require root privileges, and can be run concurrently
with other tools connecting to the local \fBgpsd\fP without causing problems.
.sp
The output will consist of one or both of the raw NMEA or native \fBgpsd\fP
sentences. Each line can be optionally time stamped. There is also an
option to exit gracefully after a given count of packets.
.sp
\fBgpspipe\fP may be run as a daemon, but requires the \fB\-o, \-\-output\fP flag
for writing the output to a file.
.SH "OPTIONS"
.sp
\fB\-?\fP, \fB\-h\fP, \fB\-\-help\fP
.RS 4
Print a usage message and exit.
.RE
.sp
\fB\-2\fP, \fB\-\-split24\fP
.RS 4
\fB\-2\fP sets the split24 flag on AIS reports.
.RE
.sp
\fB\-B\fP, \fB\-\-nobuffer\fP
.RS 4
Do not buffer the output.
.RE
.sp
\fB\-d\fP, \fB\-\-daemonize\fP
.RS 4
Run as a daemon.
.RE
.sp
\fB\-D LVL\fP, \fB\-\-debug LVL\fP
.RS 4
Set debug level to LVL.
.RE
.sp
\fB\-l\fP, \fB\-\-sleep\fP
.RS 4
Sleep for ten seconds before attempting to connect to \fBgpsd\fP. This is
very useful when running as a daemon, giving \fBgpsd\fP time to start before
attempting a connection.
.RE
.sp
\fB\-n COUNT\fP, \fB\-\-count COUNT\fP
.RS 4
Exit after COUNT messages are output.
.RE
.sp
\fB\-o FILE\fP, \fB\-\-output FILE\fP
.RS 4
Cause the collected data to be written to the specified file. Use of
this option is mandatory if \fBgpspipe\fP is run as a daemon.
.RE
.sp
\fB\-p\fP, \fB\-\-profile\fP
.RS 4
Dump profiling information in JSON.
.RE
.sp
\fB\-P\fP, \fB\-\-pps\fP
.RS 4
Enables dumping of PPS drift JSON in NMEA and raw modes.
.RE
.sp
\fB\-r\fP, \fB\-\-nmea\fP
.RS 4
Cause NMEA sentences to be output. This may be NMEA, pseudo NMEA built
from binary data, or some combination of both.
.RE
.sp
\fB\-R\fP, \fB\-\-raw\fP
.RS 4
Causes super\-raw (gps binary) data to be output. This will forward
exactly what the device sent.
.RE
.sp
\fB\-s DEV\fP, \fB\-\-serial DEV\fP
.RS 4
Cause the collected data to be written to the specified serial device
(DEV) with settings 4800 8N1. Thus \fBgpspipe\fP can be used with
\fB\-s, \-\-serial\fP and \fB\-r, \-\-nmea\fP options to emulate a serial port
hardwired to a GPS that \fBgpsd\fP is managing.
.RE
.sp
\fB\-S\fP, \fB\-\-scaled\fP
.RS 4
Set the scaled flag. This is for AIS and SUBFRAME data only. Scaled
data will be output in the JSON, instead of raw data in the JSON.
.RE
.sp
\fB\-t\fP, \fB\-\-timestamp\fP
.RS 4
Add a UTC timestamp to each sentence output.
.RE
.sp
\fB\-T FMT\fP, \fB\-\-timefmt FMT\fP
.RS 4
Set the format of the timestamp. See \fBstrftime\fP(3) for the available
placeholders. Setting this option implies \fB\-t\fP (\fB\-\-timestamp\fP). Default
setting is "%F %T"
.RE
.sp
\fB\-u\fP, \fB\-\-usec\fP
.RS 4
Use usec resolution time stamp, implies \fB\-t\fP (\fB\-\-timestamp\fP). Use twice
(\fB\-uu\fP) to output sec.usec.
.RE
.sp
\fB\-v\fP, \fB\-\-spinner\fP
.RS 4
Show a spinning activity indicator on stderr. This is useful if
stdout is redirected into a file or a pipe. By default the spinner is
advanced with every messages written; specifying \fB\-v\fP, or \fB\-\-spinner\fP,
more than once will double the number of messages required to rotate
the spinner.
.RE
.sp
\fB\-V\fP, \fB\-\-version\fP
.RS 4
Print the program version and exit.
.RE
.sp
\fB\-w\fP, \fB\-\-json\fP
.RS 4
Cause native \fBgpsd\fP JSON sentences to be output.
.RE
.sp
\fB\-x SEC\fP, \fB\-\-seconds SEC\fP
.RS 4
Exit after delay of SEC seconds.
.RE
.sp
\fB\-Z\fP, \fB\-\-zulu\fP
.RS 4
Set the timestamp format iso8601: implies \fB\-t\fP.
.RE
.sp
At least one of \fB\-R\fP, \fB\-r\fP or \fB\-w\fP must be specified.
.sp
You must use \fB\-o\fP if you use \fB\-d\fP.
.SH "ARGUMENTS"
.sp
By default, clients collect data from the local \fBgpsd\fP daemon running
on localhost, using the default GPSD port 2947. The optional argument
to any client may override this behavior: \fB[server[:port[:device]]]\fP
.sp
For further explanation, and examples, see the \fBARGUMENTS\fP section in
the \fBgps\fP(1) man page
.SH "EXAMPLES"
.sp
When \fBgpsd\fP is running, this example will send one hundred raw NMEA
sentences to standard output, then exit:
.sp
.if n .RS 4
.nf
.fam C
$ gpspipe \-r \-n 100
.fam
.fi
.if n .RE
.sp
When \fBgpsd\fP is running, this example will wait at most 5 seconds for a
TPV message, print it to stdout, then exit:
.sp
.if n .RS 4
.nf
.fam C
$ gpspipe \-x 5 \-w|sed \-n \*(Aq/TPV/{p;q}\*(Aq
.fam
.fi
.if n .RE
.sp
Use \fBgpspipe\fP and "socat* to serve NMEA from the local \fBgpsd\fP on tcp
port 2948:
.sp
.if n .RS 4
.nf
.fam C
$ socat EXEC:\*(Aqgpspipe \-r\*(Aq TCP\-LISTEN:2948,reuseaddr,fork
.fam
.fi
.if n .RE
.sp
The paranoid may wish to have \fBsocat\fP run as user \*(Aqnobody\*(Aq and only
accept connections from the local network.  Using the \fB\-B" option to
*gpspipe\fP will reduce latency and jitter  The "su=nobody" means
this must be run as root:
.sp
.if n .RS 4
.nf
.fam C
# socat EXEC:\*(Aqgpspipe \-rB\*(Aq \(rs
   TCP\-LISTEN:2948,reuseaddr,fork,su=nobody,range=192.168.0.0/24
.fam
.fi
.if n .RE
.SH "RETURN VALUES"
.sp
\fB0\fP
.RS 4
on success.
.RE
.sp
\fB1\fP
.RS 4
on failure
.RE
.SH "SEE ALSO"
.sp
\fBgpsd\fP(8), \fBgps\fP(1), \fBgpsfake\fP(1), \fBsocat\fP(1).
.SH "RESOURCES"
.sp
\fBProject web site:\fP \c
.URL "https://gpsd.io/" "" ""
.SH "COPYING"
.sp
This file is Copyright 2013 by the GPSD project
.br
SPDX\-License\-Identifier: BSD\-2\-clause
.SH "AUTHOR"
.sp
Gary E. Miller